<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <meta name="format-detection" content="telephone=no" />
    <title>提成账户提现</title>
    <link rel="stylesheet" href="../../css/reset.css">
    <style>
        body {
            width: 100%;
            height: 100%;
            font-size: 0.28rem;
            -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
            font-family: PingFang SC;
            color: #333333;
            background-color: #f8f8f8;
        }

        .cashOut {
            width: 100%;
            height: 1.94rem;
            display: flex;
            display: -webkit-flex;
            flex-direction: column;
            align-items: flex-start;
            justify-content: center;
            padding: 0 0.3rem;
            box-sizing: border-box;
            background-color: #ffffff;
            margin-top: 0.16rem;
            margin-bottom: 0.16rem;
        }

        .cashOut b {
            font-size: 0.28rem;
            color: rgba(38, 38, 38, 1);
        }

        input,
        button {
            border: none;
            outline: none;
        }

        .inputNum {
            width: 100%;
            display: flex;
            display: -webkit-flex;
            align-items: center;
            justify-content: space-between;
            border-bottom: 1px solid #E4E4E4;
        }

        .inputNum input {
            flex: 1;
            outline: none;
            border: none;
            height: 0.6rem;
            font-size: 0.3rem;
            font-weight: 400;
            padding-left: 0;
        }

        #coinInputNum::placeholder {
            color: rgba(153, 153, 153, 1);
        }

        .inputNum p {
            display: flex;
            align-items: center;
            font-size: 0.28rem;
            color: rgba(153, 153, 153, 1);
        }

        .totalChoose {
            color: #262626;
        }

        .cashOut>p {
            font-size: 0.24rem;
            color: rgba(137, 137, 137, 1);
            line-height: 0.36rem;
            margin-top: 0.18rem;
        }

        .accountType {
            width: 100%;
            height: auto;
            display: flex;
            display: -webkit-flex;
            align-items: center;
            justify-content: space-between;
            padding: .3rem;
            box-sizing: border-box;
            background-color: #ffffff;
        }

        .accountType b {
            font-size: 0.28rem;
            color: rgba(38, 38, 38, 1);
            font-weight: normal;
        }

        .chooseRadios {
            width: 100%;
            height: auto;
            display: flex;
            display: -webkit-flex;
            align-items: center;
            justify-content: flex-start;
            font-size: 0.26rem;
            font-weight: 500;
            color: rgba(153, 153, 153, 1);
            margin-top: 0.2rem;
        }

        .chooseRadios input {
            margin: 0;
            padding: 0;
        }

        .chooseRadios label {
            display: flex;
            display: -webkit-flex;
            align-items: center;
        }

        input[type="radio"]+label::before {
            content: "\a0";
            display: inline-block;
            vertical-align: middle;
            width: 0.32rem;
            height: 0.32rem;
            margin-right: .1rem;
            border-radius: 50%;
            border: 1px solid #DBDBDB;
        }

        input[type="radio"]:checked+label::before {
            width: 0.2rem;
            height: 0.2rem;
            background-color: #ffd203;
            background-clip: content-box;
            border: 1px solid #ffd203;
            padding: 0.06rem;
        }

        input[type="radio"] {
            position: absolute;
            clip: rect(0, 0, 0, 0);
        }

        .choosePersonal {
            width: 100%;
            height: auto;
            display: flex;
            display: -webkit-flex;
            flex-direction: column;
            align-items: flex-start;
            justify-content: center;
            padding: 0 0.3rem;
            box-sizing: border-box;
            background-color: #fff;
            margin-bottom: 0.16rem;
        }

        .choosePersonal p {
            width: 100%;
            height: 0.92rem;
            display: flex;
            display: -webkit-flex;
            align-items: stretch;
            justify-content: space-between;
            border-bottom: 1px solid #E5E5E5;
        }

        .choosePersonal p:last-child {
            border-bottom: none;
        }

        .choosePersonal p input {
            flex: 1;
            text-align: right;
            font-size: 0.26rem;
        }

        .choosePersonal p span {
            display: flex;
            display: -webkit-flex;
            align-items: center;
        }

        .choosePersonal p input::placeholder {
            color: #999999;
        }

        .chooseCompany {
            width: 100%;
            height: auto;
            display: flex;
            display: -webkit-flex;
            flex-direction: column;
            align-items: flex-start;
            justify-content: center;
            padding: 0 0.3rem;
            box-sizing: border-box;
            background-color: #fff;
            margin-bottom: 0.16rem;
            /* padding-bottom: 0.3rem; */
        }

        .chooseCompany p {
            width: 100%;
            height: 0.92rem;
            display: flex;
            display: -webkit-flex;
            align-items: stretch;
            justify-content: space-between;
            border-bottom: 1px solid #E5E5E5;
        }

        .chooseCompany p:last-of-type {
            border-bottom: none;
        }

        .chooseCompany p input {
            flex: 1;
            text-align: right;
            font-size: 0.26rem;
        }

        .chooseCompany p span {
            display: flex;
            display: -webkit-flex;
            align-items: center;
        }

        .chooseCompany p input::placeholder {
            color: #999999;
        }

        .upLoadImg {
            width: 100%;
            height: auto;
            display: flex;
            display: -webkit-flex;
            flex-wrap: wrap;
            align-content: flex-start;
            justify-content: flex-start;
            padding-top: 0.1rem;
        }

        .showlist {
            width: 0.92rem;
            height: 0.92rem;
            position: relative;
            margin-right: 0.44rem;
            margin-bottom: 0.4rem;
        }



        .showlist img {
            width: 0.92rem;
            height: 0.92rem;
        }

        .showlist .deletImg {
            width: 0.36rem;
            height: 0.36rem;
            position: absolute;
            right: -0.18rem;
            top: -0.18rem;
        }

        .addImg {
            width: 0.92rem;
            height: 0.92rem;
        }

        .addImg img {
            width: 0.92rem;
        }

        .checkpassword {
            width: 100%;
            height: auto;
            padding: 0 0.3rem;
            box-sizing: border-box;
            margin-top: 0.16rem;
            background-color: #fff;
        }

        .checkpassword>p {
            width: 100%;
            height: 0.9rem;
            display: flex;
            display: -webkit-flex;
            align-items: stretch;
            justify-content: space-between;
            border-bottom: 1px solid #E4E4E4;
        }

        .checkpassword>p input {
            flex: 1;
            padding-left: 0;
            font-size: 0.28rem;
        }

        .checkpassword>p span {
            display: flex;
            display: -webkit-flex;
            align-items: center;
        }

        #transactionPwd {
            text-align: right;
        }

        .checkpassword>div {
            width: 100%;
            height: auto;
            display: flex;
            display: -webkit-flex;
            justify-content: flex-end;
            margin-top: 0.16rem;
        }

        .forgetPwd {
            color: #999999;
            font-size: 0.22rem;
        }

        .checkpassword>.phonetext {
            justify-content: flex-start;
            font-size: 0.28rem;
            color: rgba(38, 38, 38, 1);
            margin-top: 0.06rem;
        }

        .buttonget {
            display: block;
            width: 1.56rem;
            height: 0.52rem;
            background: rgba(255, 209, 3, 1);
            border-radius: 0.08rem;
            font-size: 0.22rem;
            display: flex;
            display: -webkit-flex;
            align-items: center;
            justify-content: center;
        }

        #submitData {
            width: 100%;
            height: 0.88rem;
            background: rgba(255, 209, 3, 1);
            border-radius: 0.08rem;
            margin: 0.48rem 0;
            font-size: 0.28rem;
            font-family: PingFang SC;
            font-weight: 500;
            color: rgba(24, 24, 24, 1);
        }
    </style>
</head>

<body>
    <div class="cashOut">
        <b>
            提现金额
        </b>
        <div class="inputNum">
            <input type="text" name="getnum" id="coinInputNum" placeholder="请输入提现金额">
            <p><span>CNY</span>&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;<span class="totalChoose">全部</span></p>
        </div>
        <p>
            余额：<span class="chooseCoinNum">-- CNY</span>
        </p>
    </div>
    <div class="accountType">
        <b>
            账户类型
        </b>
        <span class="accountTypeClass">
            众乐邦个人
        </span>
        <!-- <div class="chooseRadios">
            <p>
                <input type="radio" name="outtype" data-value="choosePersonal" value=1 id="zhonglePrasen" checked>
                <label for="zhonglePrasen">
                    众乐邦个人
                </label>
            </p>
            <p style="margin-left: 1rem;">
                <input type="radio" name="outtype" data-value="chooseCompany" value=2 id="zhongleCompany">
                <label for="zhongleCompany">
                    个体户/公司
                </label>
            </p>
        </div> -->
    </div>
    <div class="choosePersonal hidebox" style="display: none;">
        <p style="border-top: 1px solid #e5e5e5;">
            <span>众乐邦注册姓名</span><input type="text" name="zhonglebang" id="registerName" placeholder="请输入注册姓名" readonly="true" style="background: #ffffff;color:#262626;">
        </p>
        <p>
            <span>众乐邦注册手机号</span><input type="text" name="zhonglebang" id="registerPhone" placeholder="请输入注册手机号" readonly="true" style="background: #ffffff;color:#262626;">
        </p>
    </div>
    <div class="chooseCompany hidebox" style="display: none;">
        <p style="border-top: 1px solid #e5e5e5;">
            <span>公司名称</span><input type="text" name="" id="companyName" placeholder="请输入公司名称" readonly="true" style="background: #ffffff;color:#262626;">
        </p>
        <p>
            <span>账号</span><input type="text" name="" id="companyNumber" placeholder="请输入账户" readonly="true" style="background: #ffffff;color:#262626;">
        </p>
        <p>
            <span>开户行</span><input type="text" name="" id="accountBank" placeholder="请输入开户行" readonly="true" style="background: #ffffff;color:#262626;">
        </p>
        <!-- <p>
            <span>发票<span style="font-size:0.24rem;font-weight:400;color:rgba(153,153,153,1);">(选填)</span></span><span
                style="font-size:0.24rem;font-weight:400;color:rgba(153,153,153,1);">最多上传9张</span>
        </p>
        <div class="upLoadImg">
            <div class="showlist">
                <img src="../../image/shangchuanx.png">
                <img src="../../image/guanibasdx.png" class="deletImg">
            </div>
            <div class="addImg">
                <img src="../../image/shangchuanx.png">
            </div>
        </div> -->
    </div>
    <div class="checkpassword">
        <p>
            <span>
                交易密码
            </span>
            <input type="password" name="transaction" id="transactionPwd" placeholder="请输入交易密码"
                oninput="this.value=this.value.replace(/\D/g, '')" maxlength="6">
        </p>
        <div>
            <a href="javascript:void(0)" class="forgetPwd">忘记交易密码?</a>
        </div>
        <div class="phonetext">
            手机验证码
        </div>
        <p>
            <input type="text" name="phoneCheckNum" id="phoneCheckNum" placeholder="请输入手机验证码"
                oninput="this.value=this.value.replace(/\D/g, '')" maxlength="6">
            <button style="background-color: #ffffff;" id="getSetmesseg">
                <span class="buttonget">
                    获取验证码
                </span>
            </button>
        </p>
        <button id="submitData">
            确定
        </button>
    </div>
</body>
<script src="../../script/autosize.js"></script>
<script src="../../script/jquery_three_two_one.js"></script>
<script src="../../script/fastclick.js"></script>
<script src="../../script/dotmin.js"></script>
<script src="../../script/app.js"></script>
<script>
    apiready = function () {
        var app = new APP();
        if (app.ST == "ios") {
            $("input").click(function () {
                $(this).focus().select(); //保险起见，还是加上这句。
            });
        }
        var coinType = api.pageParam.coinType;//账户类型
        var coinNum = api.pageParam.coinNum;//币种数量
        var phoneNumber = api.pageParam.phoneNum;//手机号
        var assginAccount = JSON.parse(api.pageParam.assstAccout);//后台配置账户信息
        var imgAddNum = 9;//添加照片的数量
        var accountType = 1;//默认选择终乐帮个人
        var accountTypeName = "choosePersonal";//选择的输入框
        $(".chooseCoinNum").text(coinNum + " CNY");
        var imgarr = [];//poker选择器选择的数据
        var pageArr = [];//页面提交相册数据
        var UIAlbumBrowser = api.require('UIAlbumBrowser');
        var isOpenPwd = 0;//是否开通了交易密码 关闭
        // $(".chooseRadios input").on("change", function () {
        //     accountTypeName = $(this).attr("data-value");
        //     accountType = $(this).val();
        //     $(".hidebox").fadeOut();
        //     $("." + accountTypeName).fadeIn();
        // });
        if (assginAccount.type && assginAccount.type == 1) {
            accountType = 1;
            $(".choosePersonal").fadeIn();
            if (assginAccount.name) {
                $("#registerName").val(assginAccount.name)
            }
            if (phoneNumber) {
                $("#registerPhone").val(phoneNumber);
            }
        }
        if (assginAccount.type && assginAccount.type == 2) {
            accountTypeName = "chooseCompany";
            accountType = 2;
            $(".accountTypeClass").text("个体户/公司");
            $(".chooseCompany").fadeIn();
            if (assginAccount.unit) {
                $("#companyName").val(assginAccount.unit)
            }
            if (assginAccount.card_no) {
                $("#companyNumber").val(assginAccount.card_no)
            }
            if (assginAccount.khh) {
                $("#accountBank").val(assginAccount.khh)
            }
        }
        if (!assginAccount.type) {
            if (coinType == "BTC_TC") {
                accountType = 1;
                $(".choosePersonal").fadeIn();
            } else {
                accountTypeName = "chooseCompany";
                accountType = 2;
                $(".accountTypeClass").text("个体户/公司");
                $(".chooseCompany").fadeIn();
            }
        }
        $(".totalChoose").click(function () {
            $("#coinInputNum").val(coinNum);
        });
        //请求用户是否打开了交易密码
        function getSetPass() {
            app.isPwd(function (ret) {
                if (ret.code == 200) {
                    isOpenPwd = 1;
                }
            });
        }
        getSetPass();
        var getCnySms = 0;
        //获取验证码
        function getCodeCallback() {
            // 执行倒计时
            app.countDown(60, function (value) {
                if (value.time != 0) {
                    $(".buttonget").text(value.time + "s");
                } else {
                    _fmOpt.reset();
                    $(".buttonget").text("获取验证码");
                    $("#getSetmesseg").attr("disabled", false).bind("click");
                }
            });
            app.getSmslogin({
                blackBox: isCnyCaptcha == 1 ? _fmOpt.getinfo() : "",
                yzm_token: getCnySms
            }, function (ret) {
                if (ret.code == 200) {
                    app.toast("发送成功");
                } else {
                    app.toast(ret.message);
                }
            })
        }
        //CNY 同盾插件初始化
        _fmOpt = {
            display: 'bind', //popup方式渲染验证码
            container: '#getSetmesseg', //验证码button渲染的目标DOM，自动展现方式下必需，详情见后文
            area: '', //对于custom模式，弹出窗口的加载容器，详情见后文
            partner: "renrenkj",
            appName: "renrenkj_h5",
            width: "",
            height: "",
            fmb: true,
            initialTime: new Date().getTime(),
            token: "renrenkj" + "-" + new Date().getTime() + "-" + Math.random().toString(16).substr(2),
            env: 1,
            getinfo: function () {
                return "e3Y6ICIyLjUuMCIsIG9zOiAid2ViIiwgczogMTk5LCBlOiAianMgbm90IGRvd25sb2FkIn0=";
            }
        };
        var fm = document.createElement('script');
        fm.type = 'text/javascript';
        fm.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'static.tongdun.net/captcha/main/tdc.js?ver=1.0&t=' + (new Date().getTime() / 600000).toFixed(0);
        var s = document.getElementsByTagName('script')[0];
        s.parentNode.insertBefore(fm, s);
        _fmOpt.beforeValidate = function () {
            $("#getSetmesseg").attr("disabled", true).unbind("click");
            app.checkIsMechine("sms", function (ret, err) {
                if (ret.code == 200) {
                    isCnyCaptcha = ret.data;
                    if (isCnyCaptcha == 1) {
                        _fmOpt.onSuccess = function (validateToken) {
                            if (validateToken) {
                                getCnySms = validateToken;
                                getCodeCallback();
                            } else {
                                _fmOpt.reset();
                            }
                        };
                        return true;
                    } else {
                        getCodeCallback();
                        return false
                    }
                }
            })
            return true
        }
        _fmOpt.onClose = function (params) {
            $(".buttonget").text("获取验证码");
            $("#getSetmesseg").attr("disabled", false).bind("click");
        }
        function appendImg() {
            $(".upLoadImg").empty();
            pageArr.push.apply(pageArr, imgarr);
            for (let i = 0; i < pageArr.length; i++) {
                pageArr[i].imgId = "imgid" + i;
            }
            imgarr.length = 0;//清空数组 
            var temp = doT.template($("#imgList").text());
            $(".upLoadImg").prepend(temp(pageArr));
            if (pageArr.length < 9) {
                $(".upLoadImg").append('<div class="addImg"><img src="../../image/shangchuanx.png"></div>')
            }
        }

        //ios 压缩图片
        function compressImg() {
            var t = 0;//选择图片下标
            function compressPicture() {
                var imgPirtureios = "albuios" + new Date().getTime() + ".jpg";
                if (imgarr[t].pathCopy.split(".")[1] == "png" || imgarr[t].pathCopy.split(".")[1] == "PNG") {
                    imgPirtureios = "albuios" + new Date().getTime() + ".png"
                }
                var imageFilter = api.require('imageFilter');
                imageFilter.compress({
                    img: imgarr[t].pathCopy,
                    save: {
                        imgPath: 'fs://compImage',
                        imgName: imgPirtureios
                    },
                    quality: 0.5
                }, function (ret, err) {
                    if (ret && ret.status == true) {
                        imgarr[t].newpath = "fs://compImage/" + imgPirtureios;
                    } else {
                        imgarr[t].newpath = imgarr[t].pathCopy;
                    }
                    t++;
                    if (t < imgarr.length) {
                        compressPicture();
                    } else {
                        api.hideProgress();
                        appendImg();
                        t = 0;
                    }
                });
            }
            compressPicture();
        }
        var i = 0;//选择图片下标
        function UIAlbumBrowser_transPath() {
            if (app.ST == "ios") {
                api.showProgress({
                    title: '生成图片中...',
                    text: '',
                    modal: false
                });
                UIAlbumBrowser.batchTransPath({
                    path: imgarr
                }, function (ret, err) {
                    if (ret) {
                        imgarr.length = 0;
                        ret.path.map(function (item) {
                            imgarr.push({
                                pathCopy: item
                            })
                        })
                        compressImg();
                    } else {
                        console.log("err" + JSON.stringify(err));
                    }
                });
            } else {
                api.showProgress({
                    title: '生成图片中...',
                    text: '',
                    modal: false
                });
                var n = 0;
                //安卓选择相册的压缩
                function andriosImg(params) {
                    var imgPirture = "albumanzhuo" + new Date().getTime() + ".jpg";
                    if (imgarr[n].path.split(".")[1] == "png" || imgarr[n].path.split(".")[1] == "PNG") {
                        imgPirture = "albumanzhuo" + new Date().getTime() + ".png"
                    }
                    app.compImg({
                        img: imgarr[n].path,
                        save: {
                            imgPath: 'fs://compImage',
                            imgName: imgPirture
                        },
                        quality: 0.5,
                        isClarityimg: false
                    }, function (ret, err) {
                        if (ret && ret.status) {
                            imgarr[n].newpath = app.sd + "/compImage/" + imgPirture;
                        } else {
                            imgarr[n].newpath = imgarr[n].path;
                        }
                        n++;
                        if (n < imgarr.length) {
                            andriosImg();
                        } else {
                            api.hideProgress();
                            appendImg();
                            n = 0;
                        }
                    })
                }
                andriosImg();
            }
        }
        //打开图片选择器
        $(".upLoadImg").on("click", ".addImg", function (params) {
            app.sheet({
                buttons: ["拍照", "相册"],
                cancelTitle: "取消"
            }, function (ret, err) {
                app.trigger("selectPic");
                var index = ret.buttonIndex;
                if (index == 1) {
                    app.shootPic(function (ret) {
                        var imgFileName = "cutImg" + new Date().getTime() + ".jpg";
                        if (ret.data) {
                            app.compImg({
                                img: ret.data,
                                save: {
                                    imgPath: 'fs://compImage',
                                    imgName: imgFileName
                                },
                                quality: 0.9,
                                isClarityimg: false
                            }, function (ret, err) {
                                if (ret && ret.status) {
                                    var value = {
                                        path: app.sd + "/compImage/" + imgFileName,
                                        newpath: app.sd + "/compImage/" + imgFileName
                                    }
                                    imgarr.push(value);
                                    appendImg();
                                }
                            })
                        }
                    })
                } else if (index == 2) {
                    var appVersion = app.AV.split(".");
                    if (Number(appVersion[0]) < 3) {
                        app.toast("请先升级到3.0.12版本以及以上");
                        return
                    }
                    if (Number(appVersion[2]) < 12) {
                        app.toast("请先升级到3.0.12版本以及以上");
                        return
                    }
                    UIAlbumBrowser.imagePicker({
                        max: imgAddNum - pageArr.length,
                        showCamera: false,
                        styles: {
                            bg: '#000000',
                            mark: {
                                position: 'top_right',
                                size: 20
                            },
                            nav: {
                                bg: '#000000',
                                cancelColor: '#fff',
                                cancelSize: 16,
                                nextStepColor: '#7fff00',
                                nextStepSize: 16
                            },
                            thumbnail: { //（可选项）返回的缩略图配置，**建议本图片不要设置过大** 若已有缩略图，则使用已有的缩略图。若要重新生成缩略图，可先调用清除缓存接口api.clearCache()。
                                w: 200, //（可选项）数字类型；返回的缩略图的宽；默认：原图的宽度
                                h: 200 //（可选项）数字类型；返回的缩略图的宽；默认：原图的高度
                            }
                        },
                        animation: true,
                    }, function (ret) {
                        if (ret.eventType == 'nextStep') {
                            if (ret.list && ret.list.length > 0) {
                                if (app.ST == "ios") {
                                    ret.list.map(function (item) {
                                        imgarr.push(item.path);
                                    })
                                } else {
                                    imgarr = ret.list;
                                }
                                UIAlbumBrowser_transPath();
                            }
                            UIAlbumBrowser.closePicker();
                        }
                    });
                }
            })
        });
        //防抖函数
        function debounce(fn, delay) {
            var timer;
            return function () {
                var context = this;
                var args = arguments;
                clearTimeout(timer);
                timer = setTimeout(function () {
                    fn.apply(context, args)
                }, delay)
            }
        };
        $("#coinInputNum").on("input porpertychange", debounce(function (e) {
            var thisValue = $(this).val();
            thisValue = thisValue.replace(/[^\d.]/g, "");  //清除“数字”和“.”以外的字符   
            thisValue = thisValue.replace(/\.{2,}/g, "."); //只保留第一个. 清除多余的   
            thisValue = thisValue.replace(".", "$#$").replace(/\./g, "").replace("$#$", ".");
            thisValue = thisValue.replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3');//只能输入两个小数   
            if (thisValue.indexOf(".") < 0 && thisValue != "") {//以上已经过滤，此处控制的是如果没有小数点，首位不能为类似于 01、02的金额  
                thisValue = parseFloat(thisValue);
            }
            $(this).val(thisValue);
            if (Number(thisValue) > Number(coinNum)) {
                $(this).val(coinNum);
            }
        }, 1500));
        $(".forgetPwd").on("click", function () {
            if (isOpenPwd == 2) {
                app.toast("审核中");
                return
            }
            var cointypecontract = {
                page: "common/headerwin",
                name: "forget_password_headerwin",
                param: {
                    subpage: "mine/forget_password",
                    name: "get_cash",
                    title: "忘记交易密码"
                }
            };
            var recoinNumber = JSON.stringify(cointypecontract);
            app.goPushPage(recoinNumber);
        });
        //提交参数
        function submitNum(imgUrlArr) {
            var account = app.getAccount();
            app.ajaxPro({
                url: "ipfs-withdraw/sale-withdraw",
                values: {
                    token: account.token,
                    withdraw_money: $("#coinInputNum").val().trim(),//提现金额
                    account_type: accountType,//提现的主体 1个人 2个体户/公司
                    withdraw_name: coinType,//提现的对应币种 1.BTC_TC(BTC提成) 2.IPFS_TC（IPFS提成）
                    register_name: $("#registerName").val().trim(),//主体是个人 注册姓名
                    register_phone: $("#registerPhone").val().trim(),//主体是个人 注册电话
                    company_name: $("#companyName").val().trim(),//主体是公司或者是个体商户 需要填写公司或者个体的商户名称
                    company_num: $("#companyNumber").val().trim(),//公司或者个体的银行账号
                    account_address: $("#accountBank").val().trim(),//公司或者个体的开户行
                    // invoice: imgUrlArr,//发票上传的地址 支持多张
                    smscaptcha: $("#phoneCheckNum").val().trim(),//短信验证码
                    trade_password: $("#transactionPwd").val().trim(),//交易密码
                },
                openFlower: true
            }, function (ret) {
                if (ret.code == 200) {
                    api.clearCache();
                    app.toast("提现成功");
                    app.trigger("getoutYeji");
                    app.fs.rmdirSync({
                        path: 'fs://compImage'
                    })
                    setTimeout(function (params) {
                        app.closeW("coin_getout");
                    }, 1500);
                } else {
                    app.toast(ret.message);
                }
            })
        }
        //上传图片
        function moreImgUpload() {
            var account = app.getAccount();
            var b = 0;
            var pirtueImg = [];//成功的数据
            var copyArr = JSON.parse(JSON.stringify(pageArr));
            function getupImg() {
                api.showProgress({
                    title: '上传图片中...',
                    text: '',
                    modal: false
                });
                app.uploadImg(pageArr[b].newpath, function (ret) {
                    // console.log("pageArr[" + b + "].newpath" + pageArr[b].newpath);
                    if (ret.code == 200) {
                        var fillePath = {
                            oldPath: pageArr[b].newpath,
                            httPurl: ret.data.files.path
                        }
                        pirtueImg.push(fillePath);
                    } else {
                        app.log("不合格图片下标" + b);
                    }
                    b++;
                    if (b < pageArr.length) {
                        getupImg();
                    } else {
                        api.hideProgress();
                        b = 0;
                        if (pirtueImg.length != pageArr.length) {
                            var oldArrlen = pageArr.length;//页面数据的长度
                            var suceefullen = pirtueImg.length;//成功的长度
                            var newImg = [];
                            for (var i = 0; i < pirtueImg.length; i++) {
                                var value = {
                                    newpath: pirtueImg[i].oldPath
                                }
                                newImg.push(value);
                            }
                            pageArr = JSON.parse(JSON.stringify(newImg));
                            appendImg();
                            app.toast("有" + app.numSub(oldArrlen, suceefullen) + "张大小超过限制,重新上传")
                            return
                        }
                        var upArr = [];//提交的数据
                        for (var k = 0; k < pirtueImg.length; k++) {
                            upArr.push(pirtueImg[k].httPurl);
                        }
                        submitNum(upArr);
                    }
                })
            }
            getupImg()
        };
        $("#submitData").on("click", function () {
            if (!$("#coinInputNum").val()) {
                app.toast("请输入提现金额");
                return
            }
            if (Number($("#coinInputNum").val()) < 1) {
                app.toast("提现金额最小为1");
                return
            }
            if (accountTypeName == "choosePersonal") {
                if (!$("#registerName").val()) {
                    app.toast("请输入注册姓名");
                    return
                }
                if (!$("#registerPhone").val()) {
                    app.toast("请输入注册手机号");
                    return
                }
            } else {
                if (!$("#companyName").val()) {
                    app.toast("请输入公司名称");
                    return
                }
                if (!$("#companyNumber").val()) {
                    app.toast("请输入账户");
                    return
                }
                if (!$("#accountBank").val()) {
                    app.toast("请输入开户行");
                    return
                }
            }
            if (isOpenPwd == "0") {
                app.toast("请在安全设置中设置交易密码");
                return
            }
            if (!$("#transactionPwd").val()) {
                app.toast("请输入交易密码");
                return
            }
            if (!$("#transactionPwd").val() && $("#transactionPwd").val().length < 6) {
                app.toast("请输入6位交易密码");
                return
            }
            if (!$("#phoneCheckNum").val()) {
                app.toast("请输入手机验证码");
                return
            }

            if (accountTypeName != "choosePersonal") {
                var param = {
                    dtype: "dialog89",
                    data: {
                        title: '提示',
                        conpanyName: $("#companyName").val(),
                        conpanyNum: $("#companyNumber").val(),
                        addressInfo: $("#accountBank").val(),
                        confirm: 'confirmSub',
                        confirmtxt: '确定'
                    }
                };
            } else {
                var param = {
                    dtype: "dialog53",
                    data: {
                        title: '提示',
                        text: '财务人员审核通过后，可在【记录】里查看任务ID，请用' + "<span style='color:#ED3333;'>" + $("#registerPhone").val() + '</span>' + '登陆税筹平台，完成任务',
                        cancel: 'cancel',
                        confirm: 'confirmSub',
                        cancentxt: '取消',
                        confirmtxt: '确定'
                    }
                };
            }
            //提示公共弹窗
            app.dialog(param);
        });
        app.listen("confirmSub", function () {
            submitNum("");
            // //批量上传图片
            // if (accountTypeName != "choosePersonal" && pageArr.length > 0) {
            //     moreImgUpload();
            // } else {
            //     submitNum("");
            // }
        })
        $(".upLoadImg").on("click", ".deletImg", function () {
            var thisID = $(this).attr("data-id");
            for (var j = 0; j < pageArr.length; j++) {
                if (thisID == pageArr[j].imgId) {
                    pageArr.splice(j, 1);
                }
            }
            $(this).parent().remove();//删除当前点击图片
            if (pageArr.length == 8) {
                $(".upLoadImg").append('<div class="addImg"><img src="../../image/shangchuanx.png"></div>')
            }
        })
        app.headerMap();
    }
</script>
<script type="text/html" id="imgList">
    {{~it:it:index}}
        <div class="showlist">
            <img src={{=it.newpath}}>
            <img src="../../image/guanibasdx.png" class="deletImg" data-id="{{=it.imgId}}">
        </div>
    {{~}}
</script>

</html>